System and method for maintaining order for a replicated multi-unit I/O stream

ABSTRACT

A system in which data operations for a data replication group are received in-order, and buffered. When the operations are complete, they are stored in a non-volatile memory atomically with a group sequence number. The cache is preferably mirrored. This creates a persistent association between the data operation and the sequence number. After the atomic store is performed in at least one non-volatile cache, the data operation is propagated to another member of the data replication group along with the group sequence number. In the other member, the data operation is cached at least once in a non-volatile cache atomically with the group sequence number. In this manner, the set of group sequence numbers for a plurality of operations forms a continuous ordering of the data operations.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates, in general, to data replication, and, more particularly, to software, systems and protocols for communicating between multiple pairs of storage controllers to provide data replication services.

2. Relevant Background

Recent years have seen a proliferation of computers and storage subsystems. Demand for storage capacity grows by over seventy-five percent each year. Early computer systems relied heavily on direct-attached storage (DAS) consisting of one or more disk drives coupled to a system bus. More recently, network-attached storage (NAS) and storage area network (SAN) technology are used to provide storage with greater capacity, higher reliability, and higher availability. The present invention is directed primarily SAN systems that are designed to provide shared data storage that is beyond the ability of a single host computer to efficiently manage.

Mass data storage systems are implemented in networks or fabrics that provide means for communicating data between systems that use data, and the storage systems that implement the physical storage. In many cases, host computers act as storage servers and are coupled to the network and configured with several disk drives that cumulatively provide more storage capacity or different storage functions (e.g., data protection) than could be implemented by a DAS system. For example, a server dedicated to data storage can provide various degrees of redundancy and mirroring to improve access performance, availability and reliability of stored data. Collecting storage sub-systems, where a separate server manages each sub-system, can form a large storage system. More recently, virtualized storage systems such as the StorageWorks® Enterprise Virtual Array announced by Compaq Corporation in October, 2001 provide storage controllers within a fabric or network that present virtualized storage to hosts that require data storage in a manner that enables the host to be uninvolved in the physical configuration, allocation and management of the storage devices. StorageWorks is a registered trademark of Compaq Computer Corporation in the United States and is a trademark or registered trademark in other countries. In this system, hosts simply access logical units of storage that appear to the host as a range of logical address space.

SAN systems enable the possibility of storing multiple copies or “replicas” of data at various physical locations throughout the system. Data replication across multiple sites is desirable for a variety of reasons. To provide disaster tolerance, copies of data stored at different physical locations is desired. When one copy becomes unavailable due to equipment failure, a local network outage, natural disaster or the like, a replica located at an alternate site can allow access to the data. Replicated data can also theoretically improve access in normal operation in that replicas can be accessed in parallel, avoiding bottlenecks associated with accessing a single copy of data from multiple systems.

In SAN systems, the storage controllers at various sites communicate with each other using a common data transfer protocol to coordinate storage and management activities at various sites. The data transfer protocol is key to maintain performance as well as proper ordering in a multi-volume, multi-target replication environment. Typically it is difficult for a protocol to provide either performance or guaranteed ordering, but in replication applications both are required.

A popular protocol in SANs is the small computer systems interface (SCSI) protocol family. SCSI is well established as an efficient protocol for block data transfers between host computers and storage devices. To extend the range of SCSI, fibre channel is used in SANs to provide a high-speed, long-distance data communication mechanism. Because fibre channel standards accept SCSI as a transport layer protocol, SCSI is the protocol of choice in most SAN implementations.

SCSI is a command/response protocol in which commands such as write operations are communicated over several phases that are spread out over time. Each phase involves one or more data packets transmitted over a communication medium. As a result, a command may fail if any one packet is lost in transmission. SCSI includes features to ensure in-order delivery of packets over the several phases to ensure that an integral command is performed atomically in the event that the system fails to deliver a packet. In data replication systems, however, integrity of a single command is not sufficient. In a data replication system a controller will receive a stream of commands directed to one or more storage units. The system must then implement that stream of commands in-order against all replicas of the data. Because commands may be implemented over time in multiple transactions, a command may start, but fail to complete. For example, the command may fail to be completely transferred from the host, or may fail to completely captured by the storage controller receiving the command. Hence, applying a sequencing number to the command stream becomes problematic as associating a sequence number to a command that fails to complete creates gaps in the sequence that must be corrected. To ensure that the operations are performed in-order, there exists a need for a mechanism that maintains the sequence of received commands.

SUMMARY OF THE INVENTION

Briefly stated, the present invention involves a system in which a data operation for a data replication group is received and buffered in one or more transmissions to a first controller of the data replication group. When all of the one or more transmissions are received by the first controller such that the integrity of the data operation is known, the operation is stored in a non-volatile memory atomically with a group sequence number. The non-volatile memory is preferably mirrored. This creates a persistent association between the data operation and the sequence number. After the atomic store is performed in at least one non-volatile memory, the data operation is propagated to a remote controller of the data replication group along with the global sequence number. In the remote controller, the data operation is cached at least once in a non-volatile cache atomically with the global sequence number. In this manner, the set of group sequence numbers for a plurality of operations forms a continuous ordering of the data operations.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 shows a storage area network (SAN) environment in which the present invention is implemented;

FIG. 2 illustrates in flow diagram form basic operations in accordance with the present invention;

FIG. 3 illustrates a basic implementation of the present invention;

FIG. 4 shows data flow relationships in a data replication management operation in accordance with the present invention;

FIG. 5 illustrates logical relationships between data structures of the present invention;

FIG. 6 illustrates an exemplary data structure used for storing and transmitting write operations in accordance with the present invention; and

FIG. 7 and FIG. 8 illustrate in flow-diagram form actions performed to execute replicated write operations in accordance with the present invention.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

The present invention involves a data replication system in which data is replicated such that it is stored in two or more locations, and which employs mechanisms to ensure that write operations received by any location are performed in each location in the order in which they were received. While the present invention is particularly useful in a data replication system implemented in a storage area network (SAN), it has utility in any application in which operations must be implemented in order across distributed systems and devices.

The present invention is specifically described in terms of a protocol layer implemented on top of or within a standard communication protocol such as fibre channel. However, other transmission protocols may be used instead of fibre channel. The particular examples illustrate the invention in terms of a storage area network (SAN) comprising dual controllers attached over a redundant fibre channel fabric, with at least one other pair of controllers on the same fabric, over which data is replicated for multiple volumes simultaneously, in multiple directions, and with various degrees of synchronicity. However, the specific implementation may be varied significantly while achieving some or all of the benefits of the present invention.

The fibre channel structure is defined as a five-layer stack of protocols, where the five layers define the physical media and transmission rates, encoding scheme, framing protocol and flow control, common services, and the upper level application interfaces. FC-0, the lowest layer, specifies physical characteristics of the media, transmitters, receivers and connectors. FC-1 defines the 8B/10B encoding/decoding scheme used to integrate the data with the clock information required by serial transmission techniques. FC-2 defines the framing protocol for data transferred between ports as well as the mechanisms for using Fibre Channel's circuit and packet switched service classes and the means of managing the sequence of a data transfer. FC-2 is often referred to as the “link level”. FC-3 is undefined and currently is not used. FC-4 provides integration of FC-2 level frames with existing standards and protocols such as FDDI, HIPPI, IPI-3, SCSI, Internet Protocol (IP), Single Byte Command Code Set (SBCCS), and the like.

FIG. 1 illustrates a multi-site storage area network (SAN) implementing features in accordance with present invention. In particular, the present invention relates to a protocol, including data structures and processes used to implement the protocol that enables communication between site 1, site 2, and site 3 for data replication operations. The example shown in FIG. 1 includes only three sites (Site 1, Site 2 and Site 3) to ease illustration and understanding. However, it should be understood that any number of sites might be provided to meet the needs of a particular application. The various sites may be physically proximate, or separated by an arbitrary distance. A particular implementation may well limit the number of possible sites, and may well limit the maximum or minimum physical separation of sites. Each site includes one or more storage cells 101, such as cells 101A, 101B, 101C and 101D. Any number of storage cells 101 may be included in any site, although the number implemented in any particular application may be constrained to meet the needs of that application.

The storage implemented at various sites is accessed by host computer 102, such as host computers 102A, 102B and 102C. Host computers are generally machines that consume or require data storage. Typical host computers 102 demand large quantities of storage such as mainframes, web servers, transaction processors, and the like. However, a host computer 102 may comprise a computer of any processing capacity that requires or benefits from network storage either to reduce cost of the host 102, implement more storage capacity than practical in a host 102, share data amongst multiple hosts 102, or the like. A host computer 102 may couple to the storage cells 101 via a connection to network 103 such as illustrated by host computers 102A and 102B. In many cases, a host computer 102 will be located in a site such as host computer 102C located in site 2. The topological location of host computers 102 is a matter of design choice selected to meet the needs of the particular application. In many cases, one or more host computers 102 will be located at a site. It should be appreciated, however, that host computers 102 have little to do with the management and configuration of the DRM system of the present invention, other than the reality that as consumers of data, the DRM system is preferably able to satisfy storage needs of host computers 102 at various physical and topological locations.

Storage cells 101 and hosts 102 couple to data communication network 103. Storage cells 101 implement a quantity of data storage capacity that is accessible through storage controllers 105 that implement one or more connections to network 101. Storage cells 101 typically implement hundreds of gigabytes to terabytes of physical storage capacity. Controllers 105 virtualize the physical storage capacity such that it is configurable into logical units (LUNs) of storage capacity. The LUNs implement an arbitrary quantity of logical address block storage, where each LUN has a specified level of data protection such as RAID 0-5 data protection. Hosts 102 access physical storage capacity by addressing read and write operations to specified LUNs, and can be otherwise unaware of the physical storage architecture or data protection strategy for a particular LUN that is being accessed. Storage controllers 105 manage the tasks of allocating physical storage capacity to specified LUNs, monitoring and maintaining integrity of the LUNs, moving data between physical storage devices, resizing LUNs, and other functions that maintain integrity and availability of the data stored therein.

Network 103 comprises any of a variety of available networks, and may comprise a plurality of interconnected networks. In particular examples, network 103 comprises at least two independent fibre channel fabrics to provide redundancy. These fibre channel fabrics may comprise long-distance connection mechanism such as asynchronous transfer mode (ATM) and Internet protocol (IP) connections that enable sites to be separated by arbitrary distances.

At least one SAN management appliance (SMA) 107 is coupled to network 103 to enable connections to storage cells 101. In practice, a number of SMAs 107 are provided, and typically an SMA 107 is located at each site to provide management operation for the storage cells 101 at that site. However, because each SMA 107 communicates through network 103, the physical location of SMAs 107 is arbitrary. SMAs 107 are preferably implemented at topological locations that provide redundant connections to the storage cells 101.

Network 103 is accessible directly or indirectly to all components at Site 1, Site 2, and Site 3 including hosts 102 and controllers 105. In preferred implementations, each component has redundant links to network 103, and network 103 is preferably implemented as having redundant sub-networks. Redundancy provides connectivity in event of failure or degradation of some portions of network 103 (i.e., a link failure or connection failure). Redundancy also enables connectivity in event of failure or degradation of controllers 105 and/or interface components of hosts 102.

In the system of FIG. 1, it is important to realize that and storage cell 101 is able to function as a primary storage location for any of hosts 102, and at the same time function as a secondary or alternative storage location for a replica of data from another storage cell 101. This feature is referred to as “bi-directionality”. Accordingly, each controller 105 is preferably enabled to generate and respond to the full set of commands defined by the data transfer protocol of the present invention as any storage cell 101 may be the source for a data replication group and so generate protocol messages that initiate creation of group members in other storage cells 101 and initiate write and copy operations to replicate data. Similarly, each storage cell 101 may be a destination or alternate site for a data replication group, and so respond to protocol commands from other storage cells to create data replication groups and member LUNs as well as to respond to write and copy commands to store replicated data from other storage cells 101. The write ordering mechanisms in accordance with the present invention are peer cooperative in that the behaviors required to complete a particular operation are managed in distributed fashion by all storage cells 101 participating in the operation.

FIG. 2 illustrates in flow-diagram form an overview of operations implemented by the data transfer protocol in accordance with the present invention used to establish a data replication group. Prior to formation of a data replication group a source LUN is established one site. That source LUN may be used for operational data transactions in a non-replicated fashion prior to establishing a data replication group. Alternatively, the source LUN may remain unused until the data replication group is formed. The designation of the initial LUN as a “source” has little meaning until a data replication group is formed, however, that terminology is used herein for consistency and ease of understanding.

At operation 201, a host, such as SMA 107, generates a command to create a data replication group. The host command identifies the previously created source LUN, and identifies one or more storage cells 101 that will be used for alternate sites for destination LUNs. The host command is directed to a specific controller 105 that is currently managing the previously created source LUN. At this point, destination LUNs do not exist at the alternate sites as they are created specifically to meet the requirements of the data replication group. In operation 203, the controller that receives the host command creates a local group object (e.g., object 505 in FIG. 5), which is a logical entity that represents the group in that controller. The group object 505 includes various methods to implement the data replication group behaviors, including the data transfer protocol of the present invention. Once created, the local group object 505 contains the source LUN.

In operation 205, a communication link called a tunnel is created. The tunnel is a communication link through fabric 103 that is used to communicate data replication management and data transfer operations for one or more DRM groups. A tunnel comprises of a set of resources (e.g., buffers) that are used to communicate between two controllers. Unlike a conventional SCSI over fibre channel exchange that is set up and taken down for each SCSI operation, the tunnel is self-renewing so that it persists over several operations. A physical link or path in fabric 103 may implement any number of tunnels to support data replication groups 505. Typically only one tunnel exists between any pair of source/destination pair of controllers, however, a tunnel can be formed in any available path that couples a source/destination pair of controllers 105.

Once a tunnel is created, the initial source controller sends a protocol message through the tunnel to the destination controller in operation 207 to cause the destination controller to create a remote group object. The remote group object is remote with respect to the initial source controller, but is, of course, local to the destination controller, as the designations of “remote and local” are determined from a particular perspective. Hence, the remote group object is substantially similar in construction and behavior as the local group object. The destination controller 105 generates a protocol message directed to the initial source controller 105 to indicate successful creation of the remote group object is successfully created in operation 209. At this point, a data replication group is formed and subsequent data operations in 211 to either member will result in replicated operations to the other member.

Several operations must be performed subsequent to formation of a remote group object to fully implement the data replication system at the remote site. For example, the source site will communicate information about the source LUN (such as its logical block capacity), and may communicate other information such as a desired data protection scheme for the destination LUN. Using this information, the remote group object can initiate the creation of a destination LUN that is suitable for replicating the source LUN.

FIG. 3 illustrates various features of the present invention embodied in a basic configuration. In the particular implementation, storage management appliances (SMAs) 107 include a bridge and a data replication management console (DRMC) which are cooperative software processes that each present a user interface for configuration and monitoring of DRM processes. The Bridge functions as an element manager for controllers 105, and handles basic functions of connecting to the communication network 103, issuing commands to controllers 105, and implementing security policies. All customer configuration and monitoring of DRM activities goes through the bridge. The DRMC provides increased functionality over the bridge interface, by managing solely DRM storage and providing assists, such as with site recovery.

Physical storage devices 302 are coupled to controllers 105 by a high-speed redundant connection such as fibre channel arbitrated loop (FCAL) connections. An FCAL connection allows each of tens or hundreds of individual hard disk drives to be accessed not only at high speed, but also by more than one controller 105 in a storage cell. Further, by providing redundant FCALs, one FCAL can fail while each storage device 302 remains accessible by either controller. The present invention is largely independent of the specific implementation of physical storage devices 302, and it is contemplated that other physical storage architectures will provide suitable equivalents for purposes of the present invention.

Hence, although FIG. 3 shows only a single controller 105, it is contemplated that each storage cell is preferably configured with more than one controller 105 in a redundant fashion. Further, by providing redundant FCALs, one FCAL can fail while each storage device 302 remains accessible by either controller 105. Because ports of controllers 105 are configured to handle both operational data transactions and DRM traffic, a single port connection between each controller 105 and switch 301 is all that is necessary to implement data replication features of the present invention. However, the basic configuration shown in FIG. 3 sacrifices much redundancy, and would not be recommended for most applications, but is presented here to ease understanding of the present invention. It is important to understand that a great deal of flexibility exists in configuring the present invention for specific applications. Redundant connections and components can be added and removed flexibly to meet the needs of a particular application.

FIG. 4 shows hierarchical relationships defined in accordance with the present invention to model data replication management. Prior to performing DRM operations, a storage cell 101 is implemented at each site, and a virtual disk or LUN 401 is allocated within a storage cell 101 that is handing operational data with one or more hosts 102. For any particular copy set, one virtual disk 401 is designated as a source, although it should be understood that a source virtual disk 401 might be allocated at any site implementing the DRM features of the present invention. Virtual disk 401 may comprise a plurality of physical storage resources that span multiple physical drives within the storage cell 101, and may implement any desired capacity and data protection type.

A destination virtual disk 402 is allocated within a storage cell 101 at a designated alternative or destination site. In normal operation, write operations are directed to source virtual disk 401, and copied in a background process to one or more destination virtual disks 402. Destination virtual disk 402 has the same logical storage capacity as the source virtual disk, but may provide a different data protection configuration. In other words, destination disk 402 shares all of the dependent attributes of source virtual disk 401, but is not required to share any of the independent attributes of virtual disk 401. Controllers 105 of the destination storage cell handle the allocation of destination virtual disk 402 autonomously. This allocation involves creating data structures that map logical addresses to physical storage capacity, and in a particular implementation involve processes described in greater detail in U.S. patent application Ser. No. 10/040,194 entitled “SYSTEM AND METHOD FOR ATOMIZING STORAGE” which is assigned to the assignee of the present invention and incorporated herein by reference.

A “copy set” is a set of member virtual disks where each member virtual disk is a replica of the others, and may comprise any number of replica virtual disks. While it may be easier to describe and understand the present invention by designating one virtual disk as a source or original virtual disk and the others as destinations or replicas, it is important to understand that once the copy set is created each member virtual disk is essentially a peer of all others. To create a copy set, the user designates a virtual disk as the source, and an alternate site storage cell (not a virtual disk) for the destination. The destination virtual disk does not exist prior to the copy set creation operation. Instead, it is created specifically to be a member of the copy set. Because each destination or alternative virtual disk is created on demand, it is created specifically and automatically to be compatible with the copy set. Hence, there is little or no manual procedures that must be performed to create new members for a copy set. This allows the copy set to increase (or decrease) its membership readily.

In the preferred implementation, objects do not span sites or storage controllers. Instead, objects exist at each site and are associated with each other as suggested in FIG. 5. For instance, the controller 105 views a “DRM Group” 505 as a source group associated with a destination group (represented by a dashed-line oval in FIG. 5). The controller does not have a copy set object per se, rather group members (virtual disks) that are associated with remote members (virtual disks). The copy set is represented by this association. In FIG. 5, virtual disks 501 are associated with virtual disks 502 to form a copy set and virtual disks 511 are associated with virtual disks 512 to form another copy set.

DRM groups 505 comprises a set of related virtual disks or LUNs that belong to copy sets all of which have the same source and destination. Multiple groups 505 can exist for a given source and destination combination. While in one sense a group 505 spans sites, in practice a separate logical object that represents a group is implemented in each site (i.e., each controller 105 managing a group). Hence, in another sense each group 505 comprises a set of source halves of copy sets (i.e., the source LUNs 501 and 511), or destination halves of copy sets (i.e., destination LUNs 502 and 512). A group 505 is considered a “local group” by the controller 105 that implements the group logical object, and is considered a “remote group” when implemented by another controller 105. In other words, whether a group 505 is local or remote is determined from the perspective of a particular controller 105. A local group 105 is associated with a remote group 105 when the LUNs contained in each group are in the same copy set. In a multidirectional implementation, each local group 505 will be associated with a plurality of remote groups 105.

In essence, a group contains a collection of LUNS for which a combined I/O stream must be replicated in the LUNs of each remote group to provide certain properties with regard to its interruption (e.g. a copy set holding a database and a copy set holding a journal related to the database). DRM groups 505 are used for maintaining crash consistency and preserving WRITE ordering. Crash consistency refers operation in the event that a host 102 or link to a host 102 crashes during a data transaction. In such event, it is important that the data transaction be committed to all members of the group or fail in all members of the group. In a database/journal implementation, for example, it is important to prevent a situation in which the database is modified, but the journal does not reflect the modification, or vice versa. The consistency property applies when the group has more than one member. In general, more than one virtual disk should be added to a group only if the application requires it. In most cases, a group should comprise only one member for optimal performance, in which cases the crash consistency behaviors are less important.

An important feature of the data transfer protocol in accordance with the present invention is that it enables a group 505 to maintain write ordering among the members for during normal operation, as well as during asynchronous operation and logging/merging. Asynchronous operation refers to an operation mode in which a modification to one member of a copy set can be propagated to other members of the copy set after a time delay. During this time delay, the various replicas are inexact. When asynchronous operation is allowed, it is important that all replicas eventually implement the modification. Since multiple modification operations may be pending but uncommitted against a particular replica, it is necessary that the original order in which the modifications were presented is preserved when the pending modifications are applied to each replica. Even where asynchronous operation is not explicitly allowed, a destination LUN may become unavailable for a variety of reasons, in which case a copy set is implicitly operating in an asynchronous mode.

The data transfer protocol of the present invention associates a group sequence number or GSN with write operations as they are first captured within a site, and maintains the GSN association as the operations are transferred from site to site. The group sequence is a continuous, uninterrupted sequence because a GSN value is never applied to an operation that is volatile, and an operation is never made valid until the GSN association is complete. In this manner, each site (e.g., each group object) can rely on the GSN to uniquely identify each write operation and to indicate the order of that write operation with respect to all other write operations received by the controller.

In some configurations a group may include multiple peer sites such that each site can be an active handler of host I/O operations. Each controller maintains several GSN records to track the GSN sequence of write operations it sends to other controllers, and write operations it receives from other controllers. In these cases, the controller at each site maintains an independent GSN sequence for operations in which that controller is acting as a source controller, as well as a plurality of GSN sequences for each controller from which it receives write operations. In other words each group (at each location) persistently maintains one “gsn_use” value (representing the most recent GSN that has been applied to an operation for which it is a source), one “gsn_sent” value (representing the most recent GSN that has been successfully sent to another controller), a plurality of “gsn_receive” values (one for each peer controller, each value representing the most recent GSN that has been received from that controller) and a plurality of “gsn_received” values (one for each peer controller, each value representing the most recent GSN that has been successfully received into its mirror cache).

The GSN feature is very useful in recovery operations that involve retransmission of operations between controllers as a controller can immediately identify whether it has received an operation twice. The controller can then ignore duplicates and indicate that the operations were successful. The controllers do not need to exchange information about specific operations that were or were not received, nor rely on synchronized state information indicating completion status of each operation to each controller.

FIG. 6 shows a conceptual representation of a memory structure used to implement buffer resources. It should be understood that buffers are not actually allocated in memory address order and so is not physically an array, but is an array in the sense that each of the resources is identified by consecutive exchange ID values (OX_IDs). The data transmission part of the protocol is based on initializing the hardware at one end for a set of standard Fiber Channel “exchanges” as though each “exchange” were a SCSI read of a particular size (such as 4 KB or 16 KB). The set of “exchanges” is referred to as a “bundle”. Each “exchange” is identified by a specific OX_ID than can be derived from the “tunnel index” and knowing the specific “bundle” involved. Sending data to a particular resource within a bundle involves setting up the hardware at the sending end to send a sequence of one or more Fiber Channel frames (with increasing data offsets when multiple frames are required) to the destination Fiber Channel address using the appropriate OX_ID. Acknowledgment by the receiver that the data was successfully received implies that the resource is available for further use in other transactions. Negative acknowledgment by the receiver indicates that the hardware has been re-armed to receive the data previously sent which was not correctly received. Transmission of data within a tunnel usually involves a specific “bundle” so that commands can specify exactly which resources by using schemes as simple as bit arrays (or bit masks). The precise “bundle” is inferred by the command operation code itself. In one implementation, the basic “bundle” is the “Message Frame Bundle”. Both ends must have this “bundle” allocated and initialized. Each end may independently “activate” a “Write Resource Bundle” and/or a “Copy Resource Bundle” for use by the other end and at its request.

Once a tunnel is established, each controller has pre-allocated I/O resources for handling command-response (MFCs) exchanges with the other controller. These pre-allocated resources will continue to exist for the life of the tunnel. Each end of the tunnel sends data of a kind corresponding to the “bundle” involved—as if a SCSI Read command had been received with an OX_ID that can be inferred from the “tunnel index” and the “bundle” and resource identified. In a sense, the end that is sending data behaves as if it was responding to a just-received SCSI Read command, although the protocol does not require a corresponding SCSI Read command and the commands that set up the resource on the receiving end were transmitted independently of the instant transaction to send data.

In the case of a “Message Frame”, which comprises one or more messages in a single transport frames, the hardware is set up to cause an interrupt simply due to receiving the last (and only if 2 KB frames are supported) data frame (as determined by an end of sequence indicator in a frame header). In typical applications, the interrupt does not occur until a SCSI response frame is received. The particular implementation of the protocol does not use SCSI response frames, so the hardware is capable of interrupting simply on reception of a “last” data frame.

In the “Message Frame” case, a single data frame containing one or more MFCs is processed subject to ordering rules. Once processed the hardware is set up to again respond “like a SCSI read” to the same OX_ID. The other end infers this when it receives acknowledgment for the given “Message Frame”. It should be noted that the actual physical buffer used need not be the same. It is only required that the OX_ID identify some specific 2 KB buffer known to the receiving end.

Each IU 602 (or MFC as described above) contains a vector indicating a particular processes on the receiving end that is to handle the IU 602 as well any necessary control information such to indicate the beginning and ending of an IU. Aggregation is particularly useful in sending control information in which each IU 602 may comprise a relatively small number of bytes (e.g., acknowledge messages, negative acknowledge messages, command messages, and status messages) as compared to data transfer messages which typically fill the payload sections more completely.

FIG. 7 identifies operations used in a write operation after a data replication group has been created from the perspective of a source controller 105, whereas FIG. 8 illustrates operations involved in the write operation from the destination controller's perspective. The example of FIG. 7 and FIG. 8 involves a single source storage cell 101 having dual, mirroring controllers, and a single destination storage cell 101 having dual mirroring controllers. In a particular implementation, each controller includes 1 GB of cache for a total of 2 GB for the storage cell 101. The cache is divided into read and write data, where the write data is preserved by a battery and mirrored in the redundant controller. As this division is equal between read and write data, there is an effective read cache for the subsystem of 1 GB, and an effective write cache of 256 MB of mirrored cache. Various operations shown in FIG. 7 and FIG. 8 involve interactions with the mirrored cache and would be omitted if mirrored caching were not used in a particular application.

In operation 701, a write request specifying a particular LUN has been received from a host 102. A write operation may in fact involve a series or stream of related write operations. The controller 105 that receives the write request from a host 102 is the designated source controller for the received request. The write operations are presumed to be received by the source in proper order, and the data transfer protocol in accordance with the present invention operates to preserve the order in which the operations are received as the operations are applied to other members of the data replication group.

In operation 701, the mirrored caches are locked to give exclusive access to the processes handling the write operation. As noted before, the write operation may be received in several data transmissions over some period of time. As portions of the write operation are received, they are absorbed into primary cache without validation (i.e., without being marked valid) in operation 703. Once the entire operation is received in the primary cache, it is copied to the mirror cache in operation 705. If an error prevents caching or interferes with copying the operation to the mirror cache, error-handling mechanisms within controller 101 are called the operation of which are beyond the scope of this disclosure. In operation 707, the mirror controller receives the operation into a receive buffer as shown in FIG. 6, and in operation 709 the mirror cache receives the operation. After operation 709, the write operation is securely recorded in two battery backed caches, however it is not yet marked valid (and so can not be used to commit the operation to media-based storage) in either cache.

Two group sequence number variables are maintained for mirroring purposes. A first is the GSN used variable that indicates the highest valued GSN that has been assigned to a valid write/copy operation. The second is the GSN sent variable which indicates the highest valued GSN that has been sent to another (remote) controller for data replication purposes. For simplicity in illustrating how GSNs are incremented, the illustration of FIG. 7 and FIG. 8 uses an initial GSN value of zero. However, the GSN is implemented as a four-byte value that is uniquely assigned to each operation, and is intended to wrap around infrequently if ever.

It is contemplated that GSNs can be reused by resetting the GSN back to zero at opportune times. For instance, when a merge on all destinations is completed, or when the GSN reaches a large value while not logging. Host I/O for the group is quiesced at all sites before the GSN is reset.

In operation 711, a group sequence number (GSN) is associated atomically with the write operation in cache. By atomically it is meant that the GSN can not be assigned to an operation that is incomplete or invalid, and that an operation can not be made valid unless a GSN has been assigned. The GSNs are assigned sequentially in a rigid order. Once a GSN is assigned, the gsn_use counter in the mirror cache is incremented. Hence, if the most recent operation for this group had a GSN=0001, the current operation would be associated with a GSN=0002 and the next operation would be associated with a GSN=0003. In a stream of write operations, each operation is assigned a GSN atomically in the order received.

In operation 713 the mirror cache sends an acknowledge message to the primary controller, which is received at operation 715. The primary controller stores the GSN values from the mirror cache in 717, indicating that the particular GSN has now been used. Step 717 also involves marking the operation as valid in the primary cache so that the GSN becomes associated with the operation atomically in the primary cache.

After step 717, the operation is valid in both the primary and mirror cache and can be used to form data replication operation in step 719. In operation 719, the operation is drawn from cache into one or more transmit buffers (e.g., entries 603 in the transmitting controller). Substantially conventional processes implemented in communication network 103 transport the operation to a corresponding buffer location 603 in a receiving controller. Processing will not continue to operation 721, until the remote write operation completes or fails. The gsn_sent value is not updated unless the associated operation completes to the remote or is redirected to the log (because it failed). If the controller crashes (controller failover) or dual controllers go down, gsn_use and gsn_sent values indicate that this remote write needs to be finished (i.e., reissued to the destination or to the log).

In operation 721, the primary controller sends a message to the mirror controller that the operation corresponding to the GSN has been sent, causing the mirror controller to update its gsn_sent value in operation 723. In operation 725, the mirror controller sends an acknowledgement that the gsn_sent value was updated, which is received in operation 727 by the primary controller thereby causing the primary controller to update its gsn_sent value in operation 727. If a write operation fails, the GSN can be used to identify the particular operation that failed and resend that operation.

Similar operations occur on the destination controller side as shown in FIG. 8. It should be noted that a destination controller tracks the value of the highest GSN received (gsn_rec) and the highest GSN that has been successfully received into its mirror cache (gsn_rec'd). In operation 801, an unsolicited DRM write operation is received from operation 719 in FIG. 7 and the gsn_rec value is incremented. In operation 803, a cache lock operation is executed to lock the locations of the primary and mirror cache that will be used to hold the operation. In 805, the operation is written to the primary cache without validation, then sent to the mirror cache in operation 807.

In operation 809, the mirror cache receives the operation and updates its gsn_rec value. The mirror writes the operation to its cache and validates the operation in 811 so that it can be committed to media-based storage. In operation 811, the gsn_rec'd value in the mirror controller is incremented to indicate that the operation is now stored in non-volatile memory on the receiving controller. Once the write to the mirror cache is successful, the mirror controller sends the primary controller an acknowledge message in operation 813 indicating that the mirror cache operation is successful, and in operation 815, the primary cache updates its gsn_rec'd value to so indicate, and validates its corresponding cache entry. In 817, a DRM_WRITTEN message is sent to the source controller to confirm that the write operation was successful.

Although the invention has been described and illustrated with a certain degree of particularity, it is understood that the present disclosure has been made only by way of example, and that numerous changes in the combination and arrangement of parts can be resorted to by those skilled in the art without departing from the spirit and scope of the invention, as hereinafter claimed. 

1. A method of communicating between storage controllers in a storage area network, the method comprising: receiving into a first storage controller a data operation from a host computer; associating a sequence number atomically with the data operation; and marking the data operation as valid for transmission from the first storage controller to a second storage controller after the sequence number is atomically associated with the data operation.
 2. The method of claim 1 wherein the act associating a sequence number comprises: validating that the entire data operation has been received from the host computer; copying the data operation to a primary cache in the first storage controller; copying the data operation to a mirror cache in a first mirror controller; atomically associating the sequence number with the data operation in the mirror cache and marking the operation as valid in the mirror cache; sending a message from the first mirror controller to the first storage controller indicating that the operation of atomically associating is completed; and atomically associating the sequence number with the data operation in the primary cache.
 3. The method of claim 1 wherein the sequence number comprises at least four bytes.
 4. The method of claim 1 wherein the data operation is received from the host over a multiple data transmission frames.
 5. The method of claim 1 wherein the first and second storage controllers comprise data replication management processes that implement a data transfer protocol operating at the application level of a fibre channel communication mechanism, the data transfer protocol being unspecified in the fibre channel protocol standards.
 6. The method of claim 1 wherein the act of replicating data operations further comprises: receiving a stream of data operations from the host; atomically associating a unique sequence number with each data operation in the stream of data operations.
 7. The method of claim 1 wherein second storage controller processes data operations in strict order according to the sequence number.
 8. The method of claim 1 further comprising generating a retransmission request from the second storage controller to the first storage controller, wherein the retransmission identifies the sequence number of data operations that are retransmitted to the second controller.
 9. The method of claim 8 wherein the second storage controller will discard retransmitted operations that are associated with a sequence number already processed by the second storage controller.
 10. A protocol for transactions in a storage area network (SAN) comprising at least two storage sites coupled by a fibre channel fabric, wherein each storage site comprises dual controllers, wherein at least one sending controller is sending a sequence of command and data operations to at least one receiving controller, the protocol comprising: a first protocol mechanism operable on the sending controller to atomically associate a sequence number with each data operation in the sequence of data operations; a second protocol mechanism operable on the receiving controller to independently detect when a data operation within the sequence of operations has not been received; and a third protocol mechanism operable on the receiving controller to communicate with the sending controller whether each operation in the sequence of operations has been received.
 11. The protocol of claim 10 further comprising: a fourth protocol mechanism operable on the sending controller to resend operations that have not been received by the receiving controller together with the sequence number associated with the operations.
 12. The protocol of claim 11 further comprising: a fifth protocol mechanism operable on the receiving controller to discard resent operations that have been previously received by the receiving controller as indicated by the sequence number associated with the operations. 